[Chapter 2] 2.16 Conditional Operators
Author: Bryan Costales & Eric Allman
Date: 1999-02-04T00:04:29Z

#

| Chapter 2 The sendmail.cf File |

## 2.16 Conditional Operators

Conditional operators allow text to be inserted that depends on the value in a macro. Conditional operators are never used in rules, but are often used in header definitions (see §31.6).

>     $?macro result $| alternate $.

If the macro has a value, the entire expression is replaced by result. Otherwise, the entire expression is replaced by alternate. For example:

>     From: $?x$x <$g>$|$g$.

Here, if $x has a value (the `$?x`), the entire expression becomes:

>     From: $x <$g>

Otherwise (the `$|$g`), it becomes:

>     From: $g

The $. is last and terminates the conditional expression. Conditional expressions may nest, but nesting is discouraged.

2.15 Operators that Return a Triple |  | 2.17 Hints